package com.nondo.rdp.finance.model.analysis;

import com.nondo.rdp.finance.common.DateProcessUtils;
import com.nondo.rdp.auth.model.UserBeanInner;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 金融圈-分析
 */
public class AnalysisCommentBean {

    private Long id;        //自增ID
    private AnalysisBeanInner analysis = new AnalysisBeanInner();  //评论的圈子
    private UserBeanInner user;      //评论用户
    private String body; //回复内容
    private String coment;   //作者回复
    private Long upNum; //点赞数量
    private Date authorComentDate;//作者回复时间
    private int isUp; //当前用户是否已经点赞
    private Date createDate;// 创建日期
    private String createDateString; //格式化后的创建日期
    private String authorComentDateString;//格式化后的作者回复时间

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public AnalysisBeanInner getAnalysis() {
        return analysis;
    }

    public void setAnalysis(AnalysisBeanInner analysis) {
        this.analysis = analysis;
    }

    public UserBeanInner getUser() {
        return user;
    }

    public void setUser(UserBeanInner user) {
        this.user = user;
    }

    @NotNull(message = "回复内容不能为空")
    @Length(min = 1, max = 100, message = "回复内容不能超过100个字")
    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getComent() {
        return coment;
    }

    public void setComent(String coment) {
        this.coment = coment;
    }

    public Long getUpNum() {
        return upNum;
    }

    public void setUpNum(Long upNum) {
        this.upNum = upNum;
    }

    public Date getAuthorComentDate() {
        return authorComentDate;
    }

    public void setAuthorComentDate(Date authorComentDate) {
        this.authorComentDate = authorComentDate;
    }

    public int getIsUp() {
        return isUp;
    }

    public void setIsUp(int isUp) {
        this.isUp = isUp;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getCreateDateString() {
        return DateProcessUtils.showTimeText(createDate);
    }

    public void setCreateDateString(String createDateString) {
        this.createDateString = createDateString;
    }

    public String getAuthorComentDateString() {
        if (authorComentDate != null) {
            return DateProcessUtils.showTimeText(authorComentDate);
        }
        return authorComentDateString;
    }

    public void setAuthorComentDateString(String authorComentDateString) {
        this.authorComentDateString = authorComentDateString;
    }

    public class AnalysisBeanInner {
        private Long id;        // 编号

        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }
    }
}
